class LoginLog < ActiveRecord::Base
  belongs_to :company
  belongs_to :department
  belongs_to :employee
  
  def self.recordLoginInfo(companyId , departmentId , employeeId , name , password , ip ,desc)
    begin
      loginLog = LoginLog.new
      loginLog.company_id = companyId
      loginLog.department_id = departmentId
      loginLog.employee_id = employeeId
    
      loginLog.name = name
      loginLog.password = password
    
      loginLog.action_date = Time.now
      loginLog.description = desc
      loginLog.ip = ip

      loginLog.save!
    rescue Exception => e
      puts "----------------------recordLoginInfo Exception--------------------------"
      puts e
    end
  end

end
